<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="inc/header.jsp"%>
<%@taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<title>Login Form with Email Password Link</title>
	<meta http-equiv="content-type" content="text/html; charset=utf-8" />
	<link rel="stylesheet" type="text/css" media="screen" href="${pageContext.request.contextPath}/css/screen.css" />
	<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery.js"></script>
	<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery.validate.js"></script>


	<script type="text/javascript">
		
	$(function() {
		// highlight 
		var elements = $("input[type!='submit'], textarea, select");
		elements.focus(function(){
			$(this).parents('li').addClass('highlight');
		});
		elements.blur(function(){
			$(this).parents('li').removeClass('highlight');
		});
		
		$("#login").validate()
	});
	
	function refreshCode(id) {
		id=id||"verifyPic";
		document.getElementById(id).src = document
				.getElementById(id).src
				+ "?" + Math.random();
	}
	</script>
	
</head>
<body>
	<div id="page">
		<div id="header">
			<h1 style="text-align:center;">Welcome to my java study world!</h1>
		</div>

		<div id="content">
			<p id="status"></p>
			<form:form method="POST" id="login" action="login">
				<fieldset>
					<legend>User details</legend>
					<form:errors path="error" class="error" />
					<ul>
						<li>
							<label for="username"><span class="required">User Name</span></label>
							<input id="username" name="username" class="text required" type="text" value="${command.username}" /> 
							<form:errors path="username" class="error" />
						</li>
						
						<li>
							<label for="password"><span class="required">Password</span></label>
							<input name="password" type="password" class="text required" id="password" value="${command.password}" />
							<form:errors path="password" class="error" />
						</li>
						
						<li>
							<label for="validateImg"><span class="required">验证码</span></label>
							<input name="validateImg" type="text" maxlength="4" class="required" id="validateImg" value="${command.validateImg}" />
							<img width="55" src="${pageContext.request.contextPath}/checkImg" id="verifyPic" alt="换一张" onclick="refreshCode();" />
							<form:errors path="validateImg" class="error" />
						</li>
					</ul>
				</fieldset>
				
				<fieldset class="submit">
					<input type="submit" class="button" value="Login" style="width: 100px;" />
				</fieldset>
				
				<div class="clear"></div>
			</form:form>
			
			</div>
	</div>
	
</body>
</html>
